package structural.composite;

/**
 * @Description: 测试类
 * @Author: lxt
 * @CreateDate: 2019/11/1
 **/
public class CompositeTest {
    public static void main(String[] args) {
        AbstractDirectory gender = new DirectoryInfo("性别");
        gender.add(new DirectoryItem("女", "0"));
        gender.add(new DirectoryItem("男", "1"));
        gender.add(new DirectoryItem("未知", "3"));
        System.out.println(gender.toString());

        AbstractDirectory root = new DirectoryInfo("根节点");
        root.add(gender);
        AbstractDirectory nation = new DirectoryInfo("民族");
        nation.add(new DirectoryItem("测试","1"));
        root.add(nation);
        System.out.println(root);
    }
}
